next up previous
Next: 3.2 Bad Assumptions about Up: 3 Generic 64-bit Portability Previous: 3 Generic 64-bit Portability

3.1 Listen to Your Compiler

The best advice for making sure code will operate correctly in a 64-bit environment is to pay attention to the warnings generated by your compiler. Because 64-bit compiler writers anticipate 32-bit code will be ported to 64-bit systems, compilers for 64-bit systems tend to generate portability warnings about coding practices that are not portable or risky in 64-bit environments. Even modern 32-bit compilers generate reasonable warnings relevant to 64-bit porting. If your compiler does not generate particularly comprehensive warnings, try lint or a better compiler.

When you compile 32-bit code on a 64-bit system, turn on the maximum useful warnings and study the output for the kinds of problems discussed below. Definitely use ANSI C or C++ prototypes to maximize the error checking. Prototypes verify correct type matching across function boundaries.



next up previous
Next: 3.2 Bad Assumptions about Up: 3 Generic 64-bit Portability Previous: 3 Generic 64-bit Portability



Mark Kilgard
Sat Dec 30 11:52:07 PST 1995